﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace ElingOA6_DSJCJ.BLL
{
    /// <summary>
    /// 软件类别 逻辑类
    /// </summary>
    public class SoftwareCatalog
    {
        /// <summary>
        /// 软件类别数据类
        /// </summary>
        private DAL.SoftwareCatalog softwareCatalogDAL = new DAL.SoftwareCatalog();
        /// <summary>
        /// 构造函数
        /// </summary>
        public SoftwareCatalog()
        {
        }
        /// <summary>
        /// 根据公司编码获取软件类别
        /// <creator>wangl</creator>
        /// <date>2013-09-10</date>
        /// </summary>
        /// <param name="entityNo"></param>
        /// <returns></returns>
        public List<Model.SoftwareCatalog> GetModelListByFEntityNo(string entityNo)
        {
            DataSet ds = softwareCatalogDAL.GetListByFEntityNo(entityNo);
            return DataTableToList(ds.Tables[0]);
        }
        /// <summary>
        /// 得到一个对象实体
        /// <creator>wangl</creator>
        /// <date>2013-09-10</date>
        /// </summary>
        /// <param name="softwareCatalogID">软件种类编号</param>
        /// <param name="entityNo">公司编号</param>
        /// <returns></returns>
        public Model.SoftwareCatalog GetModel(decimal softwareCatalogID, string entityNo)
        {
            return softwareCatalogDAL.GetModel(softwareCatalogID, entityNo);
        }
        /// <summary>
        /// 获得数据列表
        /// <creator>wangl</creator>
        /// <date>2013-09-10</date>
        /// </summary>
        public List<ElingOA6_DSJCJ.Model.SoftwareCatalog> DataTableToList(DataTable dt)
        {
            List<ElingOA6_DSJCJ.Model.SoftwareCatalog> modelList = new List<ElingOA6_DSJCJ.Model.SoftwareCatalog>();
            int rowsCount = dt.Rows.Count;
            if (rowsCount > 0)
            {
                ElingOA6_DSJCJ.Model.SoftwareCatalog model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = softwareCatalogDAL.DataRowToModel(dt.Rows[n]);
                    if (model != null)
                    {
                        modelList.Add(model);
                    }
                }
            }
            return modelList;
        }
    }

}
